home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_200
/
227_01
/
graf.s
< prev
next >
Wrap
Text File
|
1988-02-07
|
63KB
|
1,814 lines
.tr ~
.SA 1
.PH "''Compatible graphics library''"
.PF "''Page \\\\nP''"
.DS C
Public Domain Compatible Graphics Library
.sp 1
The C User's Group
.sp 1
Author
Rainer Gerhards
Petronellastr. 6
D-5112 Baesweiler
West Germany
.sp 1
Library Version
2.1, 11/15/1987
.sp 1
Documentation Version
2.1 (11/15/87 16:56:50)
.sp 2
supported operating systems
MS-DOS or PC-DOS 2.0 or higher
.sp 1
supported C compilers
Lattice C 3.0
Datalight C 2.23
Borland Turbo C 1.0
[Microsoft C]
.sp 1
supported graphics cards
Hercules monochrome graphics card
enhanced graphics adapter (EGA)
IBM std. BIOS interface
Elsa PC XXHR vector graphics board
.sp 1
supported graphics printer
Nec pinwriter P6 / P7
Epson \(*TM compatible printers
.sp 1
supported plotters
--- currently none ---
.DE
.bp
.ll -10
.in +10
.fi
This document describes the compatible
graphics library for almost every (strong words, I know)
computer. Everybody is free to copy,
adapt or modify the listed sources
and documentation. It would be nice, if
you copy this acknowledgment and the authors
name and address too.
.br
If you have new ideas or improvements
please contact the author.
.ll +10
.in -10
.sp 0
.SK
.H 1 "Introduction"
.H 2 "Design history and background"
.fi
This library was first designed as a demonstration library for very fast
assembly language routines.
But after a while using it, I think that this C library is much more powerful
than the assembly language library is.
Ok, the assembly language library is somewhat faster, but it hasn't the ability to run on all well-known graphics devices for the IBM PC.
And I think it will be a horrible task to port the library to a really different
environment - an Unix machine for example.
This is a much more easy task with the C language library.
.br
So this C library builds the base of a compatible graphics system, which will
run
on a CP/M machine as well as on a big Unix system.
Currently only parts of the IBM personal computer hardware are supported,
because I own no other hardware. I hope, that other users will help to
make this library really portable and powerful.
.sp 1
While the first version implemented only the basic tasks, the current version
(2.1) has many intersting features and is greatly enhanced
above version 1.1.
It is very nice to move from one video device to another without source-code
changes.
I also improved the speed and memory requirements of the library dramatically,
and so
I think this version covers a lot of serious projects.
.sp 1
I hope that some of you
have some interesting ideas and algorithms and want to tell me about them.
So I hope to get a full praxis-driven library.
In addition, I hope that some of you want to port the low-level parts of the
library to different machines and graphics environments, making the library
really portable.
Everybody should feel free to contact me!
.H 2 "Current features"
.fi
The most powerful feature of the library is its compatibility and hardware
independency.
You may use the library on many machines, as long as there's driver
available.
And new drivers can be very simply added.
.sp 1
The library currently supports:
.DL
.LI
switching between different display modes (graphics/nongraphics)
.LI
drawing pixels
.LI
drawing lines
.LI
drawing polylines
.LI
drawing boxes
.LI
filling boxes with given colors (e.g. clear windows)
.LI
draw any ellipses in full or in part
.LI
paint any region on the screen with a given color. The region is defined by
a border color.
.LI
you may use a global coordinate system, freeing you from the given hardware
parameters. Also very useful in numerical applications.
.LI
print graphics screens as a hardcopy function.
This is currently limited to the Hercules graphics card and Epson compatible
printers.
.LI
clear the graphics screen.
.LI
read the color of a specified pixel.
.LI
output text in different styles with user selectable foreground and background
colors.
.LI
use a library error-code system. Errors occurred while processing graphics
Information may be printed with a function like perror.
.LI
a full turtle graphics system
.LI
different device write modes.
New drawing may be modifyed according to the old video contents (XOR them,
e. g.).
.LE
.H 2 "new features and enhancements of version 2.1"
The following new features, enhancements and bug fixes have been applied to
the library since version 2.1:
.DL
.LI
A bug in the medium-level header file has been fixed.
The EGA-mode was defined in this header file, resulting in bad coding
sequences for devices other than EGA.
This define has been moved to the right place in the EGA low-level header
file.
.br
Note that the version 1.1 distribution disk was corrupted by this bug.
.LI
A bad bug in herc.c, the C-part of the hercules low-level driver has been
detected and removed.
Mr. Decker of Nuernberg, West Germany reported my, that the given port
address in this low-level driver were incorrect.
As a result, the switch into the hercules graphic mode was unsuccessful.
I'm sorry, the Hercules emulation I use on the QuadEGA switched always
correctly to graphics mode, so I don't saw an error.
Sorry to all Hercules users who only saw a black screen!
This bug has been corrected (two addresses, dammed!).
.LI
The low-level driver for the Hercules graphics card and the EGA have been
greatly improved and speeded up.
New internal function calls have been added, resulting in a great speedup of
the whole library code.
This effect is extreme in function paint and line.
.LI
The hercules low-level driver has a much better hardcopy routine.
The new routine optimizes the print-output before sending it to the printer,
resulting in a great decrease of print-time, if the screen is nearly blank.
The more information is presented on the graphics screen, the less the
decrease of print time will be, but I think it's really good for many
applications.
.LI
The stack space needed by function paint has been dramatically reduced.
It now requires only about 20% of the original space.
Also the processing time has been reduced.
.LI
The assembly language macros have been implemented.
Version 1.1 used the Lattice macros, which couldn't be distributed due
to copyright limitations.
The now written macro package implements all used Lattice macros in a manner,
that makes moving to a new compiler an relatively easy task.
Also some macros have been defined for this reason, which weren't implemented
in the Lattice package.
You may find the macro package also of interest for your own assembly language
routines, the documentation should be good enough to use them.
They are not documented as part of the library, because their internal
implementation is not guaranteed to be the same in the next release.
.br
Nevertheless, there are some parameters the user must set to correct assemble
the sources.
This parameters are described below.
.LI
A new set of parameters have been added to the medium-/high-level header file
"graphics.h".
These parameters allows it the user to modify some minor configuration
parameters.
The usage of this mechanism will be described below.
.LI
The text-output system has been added.
It is currently not complete implemented, but offers a good chance to do
most text-output jobs.
.LI
The new function polyline has been added.
It allows the user to draw a complex figure or line with only one function
call.
It is able to work on a variable table which holds line coordinates.
All the coordinates are concatenated with a user-specified color.
.LI
An error system has been implemented.
Functions, which may detect error conditions return -1 if an actual error
occurred, 0 otherwise.
In case of an error return, the global variable "gr_error" may be examined
for the exact error reason.
The function "grperror" has been added to print the error message in a
human-readable form.
It is much like perror, but with increased functionality.
The error system is described in greater detail below.
.LI
A complete turtle graphics system has been added.